export const appColumns = [
  {
    title: '应用程序名',
    dataIndex: 'programName',
  },
  {
    title: '版本',
    dataIndex: 'programVersion',
  },
  {
    title: '安装包下载地址',
    dataIndex: 'programUrl',
  },
  {
    title: '安装目录',
    dataIndex: 'programDir',
  },
  {
    title: '操作',
    dataIndex: 'action',
    width: '110px',
  },
];
export const columns = [
  {
    title: '组件名称',
    dataIndex: 'name',
    width: 200,
    key: 'name',
  },
  {
    title: '微服务端口号',
    dataIndex: 'port',
    width: 100,
    key: 'port',
  },
  {
    title: '微服务访问前缀',
    dataIndex: 'contextPath',
    width: 200,
    key: 'contextPath',
  },
  {
    title: '标志',
    dataIndex: 'label',
    width: 200,
    key: 'label',
  },
  {
    title: '操作',
    dataIndex: 'action',
    width: 200,
    key: 'action',
  },
];

export const mirrorColumns = [
  {
    title: '名称',
    dataIndex: 'name',
    width: 200,
    key: 'name',
  },
  {
    title: '组件名称',
    dataIndex: 'componentName',
    width: 200,
    key: 'componentName',
  },
  {
    title: '镜像版本',
    dataIndex: 'version',
    width: 150,
    key: 'version',
  },
  {
    title: '所属组织',
    dataIndex: 'organization',
    width: 100,
    key: 'organization',
  },
  {
    title: '镜像仓库地址 ',
    dataIndex: 'address',
    width: 200,
    key: 'address',
  },
  {
    title: '镜像全称 ',
    dataIndex: 'image',
    width: 200,
    key: 'image',
  },
  {
    title: '是否优选 ',
    dataIndex: 'preferred',
    customRender: (record) => {
      return record.record.preferred === true ? '是' : '否';
    },
    width: 200,
    key: 'preferred',
  },
  {
    title: '组件版本 ',
    dataIndex: 'componentVersion',
    width: 200,
    key: 'componentVersion',
  },
  {
    title: '操作',
    dataIndex: 'action',
    width: 100,
    key: 'action',
  },
];

export const appsColumns = [
  {
    title: '第三方应用',
    dataIndex: 'app',
    width: 180,
    ellipsis: true,
  },
  {
    title: '服务端安装包地址',
    dataIndex: 'cloudLinkServerUrl',
    width: 180,
    ellipsis: true,
  },
  {
    title: '客户端安装包地址',
    dataIndex: 'cloudLinkClientUrl',
    width: 180,
    ellipsis: true,
  },
  {
    title: '云联认证回调URL',
    dataIndex: 'cloudLinkAuthUrl',
    width: 180,
    ellipsis: true,
  },
  {
    title: '服务端可执行程序安装目录',
    dataIndex: 'cloudLinkServerDir',
    width: 180,
    ellipsis: true,
  },
  {
    title: '云联clusterkey',
    dataIndex: 'clusterkey',
    customRender: ({ record }) => {
      return record === undefined ? '' : '******';
    },
    width: 180,
    ellipsis: true,
  },
  {
    title: 'Web Port',
    dataIndex: 'managePort',
    width: 180,
    ellipsis: true,
  },
  {
    title: 'Rdp Port',
    dataIndex: 'rdpPort',
    width: 180,
    ellipsis: true,
  },
  {
    title: 'Microsoft Visual C++ 2008 Redistributable -x86 安装包下载地址',
    dataIndex: 'vcredistX86Url',
    width: 180,
    ellipsis: true,
  },
  {
    title: 'Microsoft Visual C++ 2008 Redistributable -x64 安装包下载地址',
    dataIndex: 'vcredistX64Url',
    width: 180,
    ellipsis: true,
  },
  {
    title: '操作',
    dataIndex: 'action',
    width: 110,
  },
];
export const moduleColumns = [
  {
    title: '模块名称',
    dataIndex: 'name',
  },
  {
    title: '协议',
    dataIndex: 'protocol',
  },
  {
    title: '端口号',
    dataIndex: 'port',
  },
  {
    title: 'ECS云服务器UUID',
    dataIndex: 'cloudServerUuid',
  },
  {
    title: '安全组',
    dataIndex: 'securityGroupName',
  },
  {
    title: '操作',
    dataIndex: 'action',
    width: '300px',
  },
];
export const infoSchema = [
  {
    field: 'name',
    required: false,
    dynamicDisabled: true,
  },
  {
    field: 'nameEn',
    required: false,
    dynamicDisabled: true,
  },
  {
    field: 'architecture',
    required: false,
    dynamicDisabled: true,
  },
  {
    field: 'version',
    required: false,
    dynamicDisabled: true,
  },
  {
    field: 'rdpPort',
    required: false,
    dynamicDisabled: true,
  },
  {
    field: 'name',
    required: false,
    dynamicDisabled: true,
  },
  {
    field: 'architecture',
    required: false,
    dynamicDisabled: true,
  },
  {
    field: 'version',
    required: false,
    dynamicDisabled: true,
  },
  {
    field: 'description',
    required: false,
    dynamicDisabled: true,
  },
  {
    field: 'idaasAppId',
    required: false,
    dynamicDisabled: true,
  },
  {
    field: 'idaasClientId',
    required: false,
    dynamicDisabled: true,
  },
  {
    field: 'idaasClientSecret',
    required: false,
    dynamicDisabled: true,
  },
  {
    field: 'domain',
    required: false,
    dynamicDisabled: true,
  },
  {
    field: 'ifIntegrateThirdApp',
    required: false,
    dynamicDisabled: true,
  },
  {
    field: 'ifIntegrateCm',
    required: false,
    dynamicDisabled: true,
  },
  {
    field: 'cmAppId',
    required: false,
    dynamicDisabled: true,
  },
  {
    field: 'cmProductId',
    required: false,
    dynamicDisabled: true,
  },
  {
    field: 'prodsysInterfaceAddress',
    required: false,
    dynamicDisabled: true,
  },
];
export const createSchema = [
  {
    field: 'name',
    required: true,
    dynamicDisabled: false,
  },
  {
    field: 'nameEn',
    required: true,
    dynamicDisabled: false,
  },
  {
    field: 'architecture',
    required: true,
    dynamicDisabled: false,
    componentProps: ({ formActionType }) => {
      return {
        placeHolder: '请选择应用架构',
        options: [
          {
            label: '微服务',
            value: '微服务',
          },
          {
            label: '单体',
            value: '单体',
          },
        ],
        onChange: async (e) => {
          const { setFieldsValue, updateSchema } = formActionType;
          setFieldsValue({
            ifIntegrateThirdApp: false,
          });
          if (e === '单体') {
            updateSchema({
              field: 'ifIntegrateThirdApp',
              dynamicDisabled: false,
            });
          } else {
            updateSchema({
              field: 'ifIntegrateThirdApp',
              dynamicDisabled: true,
            });
          }
        },
      };
    },
  },
  {
    field: 'version',
    required: true,
    dynamicDisabled: false,
  },
  {
    field: 'rdpPort',
    required: true,
    dynamicDisabled: false,
  },
  {
    field: 'name',
    required: true,
    dynamicDisabled: false,
  },
  {
    field: 'architecture',
    required: true,
    dynamicDisabled: false,
  },
  {
    field: 'version',
    required: true,
    dynamicDisabled: false,
  },
  {
    field: 'description',
    required: true,
    dynamicDisabled: false,
  },
  {
    field: 'idaasAppId',
    required: true,
    dynamicDisabled: false,
  },
  {
    field: 'idaasClientId',
    required: false,
    dynamicDisabled: false,
  },
  {
    field: 'idaasClientSecret',
    required: false,
    dynamicDisabled: false,
  },
  {
    field: 'domain',
    required: false,
    dynamicDisabled: false,
  },
  {
    field: 'ifIntegrateThirdApp',
    required: true,
    dynamicDisabled: false,
  },
  {
    field: 'ifIntegrateCm',
    required: true,
    dynamicDisabled: false,
  },
  {
    field: 'cmAppId',
    required: false,
    dynamicDisabled: false,
  },
  {
    field: 'cmProductId',
    required: false,
    dynamicDisabled: false,
  },
  {
    field: 'prodsysInterfaceAddress',
    required: false,
    dynamicDisabled: false,
  },
];
